<?php if(!defined('A')) exit;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站内容管理系统</title>
<?php
loadcss(array('reset','shell'));
loadjs('jquery',P_JS);
loadjs(array('tab','util','table'));
?>
<script type="text/javascript">
$(document).ready(function(e) {
var smallNowTab;
var pt = new Tabs();
pt.classpre="smalltab_";
pt.container = "smalltab_container";
pt.createTab("t1","编辑会员组","",true,"n");
pt.init = function(){
	smallNowTab = pt.nowTab;
};
pt.onclick = function(){
	smallNowTab = pt.nowTab;
};		
pt.initTab();
pt.clickNowTab();    
});

$(document).ready(function(e) {
     //全选
     $("#CheckedAll").click(function(){
	     $("[name^='priv_checkbox']:checkbox").attr('checked', true);
	 });
	 //全不选
     $("#CheckedNo").click(function(){
	    $("[name^='priv_checkbox']:checkbox").attr('checked', false);
	 });
});
</script>
<style>
body{margin:10px;}
</style>
</head>
<body>
<table class="settop">
<tr>
<td class="settop_left">
&nbsp;&nbsp;
</td>
<td>
<div id="smalltab_container"></div>
</td>
</tr>
</table>
<div class="smalltab_line"></div>
<div id="t1">
<br />
<br />
<form action="<?php echo url('front_group','mod_','id='.$data['id']);?>" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="0" class="mytable">
  <tr>
    <td align="right"><span class="red">名称：</span></td>
    <td align="left"><input type="text" name="name" id="" class="input" value="<?php echo $data['name'];?>" /></td>
  </tr>
  <tr>
    <td align="right">权限：</td>
    <td align="left"><strong>请选择</strong><input type="button" id="CheckedAll" value="全　选"/>
    <input type="button" id="CheckedNo" value="全不选"/></td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td align="left">
    <?php 
	foreach($controllers as $k=>$v){
		$name=array_shift($v[1]);
	?>
    <p>(<?php echo $k+1;?>) <strong><?php echo $name[0];?> [<?php echo $v[0];?>]</strong></p>
    <p>
    	<?php
		$tmp=isset($priv_checkbox[$v[0]])?$priv_checkbox[$v[0]]:array();
        foreach($v[1] as $key=>$value){
			if(in_array($value[1],$tmp)){
				$checked=' checked="checked" ';	
			}else{
				$checked='';
			}
		?>
        <span class="green"><label><input type="checkbox" <?php echo $checked;?> name="priv_checkbox[<?php echo $v[0];?>][]" value="<?php echo $value[1];?>" /> <?php echo $value[0];?>(<?php echo $value[1];?>)</label></span>&nbsp;&nbsp;
        <?php
		}
		?>
    </p>
    <?php
	}
	?>
    </td>
  </tr>
  <tr>
    <td align="right">菜单：</td>
    <td align="left"><textarea name="menu" cols="60" rows="4"><?php echo $data['menu'];?></textarea></td>
  </tr>
  <tr>
    <td align="right">状态：</td>
    <td align="left"><?php echo form_radio('status',array(1=>'正常',0=>'屏蔽'),$data['status']);?></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" value="提交" class="color_btn color_btn_green" /></td>
    </tr>
</table>
</form>
</div>
</body>
</html>